package com.vito.oa.act.extend.service.impl;

import static com.vito.oa.act.constant.OaActContants.CACHE_ACT_VALUE;
import static com.vito.oa.act.extend.model.OaActExApproveInfoModel.CACHE_KEY;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;

import com.alibaba.dubbo.config.annotation.Service;
import com.vito.act.service.impl.ActExApproveInfoServiceImpl;
import com.vito.base.model.DataGrid;
import com.vito.base.model.MyHashMap;
import com.vito.oa.act.extend.dao.OaActExApproveInfoMapper;
import com.vito.oa.act.extend.model.OaActExApproveInfoModel;
import com.vito.oa.act.extend.service.OaActExApproveInfoService;

@Service
public class OaActExApproveInfoServiceImpl extends ActExApproveInfoServiceImpl implements OaActExApproveInfoService {
	@Autowired
	private OaActExApproveInfoMapper actExApproveInfoMapper;

	@Override
	@Cacheable(value = CACHE_ACT_VALUE, key = CACHE_KEY)
	public DataGrid<MyHashMap<String, String>> queryOaLaunchByUserId(OaActExApproveInfoModel actExApproveInfoModel) {
		DataGrid<MyHashMap<String, String>> data = new DataGrid<MyHashMap<String, String>>();
		data.setRows(actExApproveInfoMapper.queryLaunchByUserIdByPage(actExApproveInfoModel));
		data.setTotal(actExApproveInfoModel.getTotal());
		return data;
	}

	@Override
	@Cacheable(value = CACHE_ACT_VALUE, key = CACHE_KEY)
	public DataGrid<MyHashMap<String, String>> queryOaApproveByUserId(OaActExApproveInfoModel actExApproveInfoModel) {
		DataGrid<MyHashMap<String, String>> data = new DataGrid<MyHashMap<String, String>>();
		data.setRows(actExApproveInfoMapper.queryApproveByUserIdByPage(actExApproveInfoModel));
		data.setTotal(actExApproveInfoModel.getTotal());
		return data;
	}

	@Override
	@Cacheable(value = CACHE_ACT_VALUE, key = CACHE_KEY)
	public DataGrid<MyHashMap<String, String>> queryOaLaunchByRootDept(OaActExApproveInfoModel actExApproveInfoModel) {
		DataGrid<MyHashMap<String, String>> data = new DataGrid<MyHashMap<String, String>>();
		data.setRows(actExApproveInfoMapper.queryLaunchByRootDeptByPage(actExApproveInfoModel));
		data.setTotal(actExApproveInfoModel.getTotal());
		return data;
	}
}